The present invention relates to a process for controlling the compression ratio of digital images.
The amount of digital images increases each year as new applications are found for them. However, an enormous amount of data is needed to represent a single digital image. Speaking generally, this amount of data is so large that storing and transmitting the images in their original representation is too costly and thus impractical, both from the point of view of the digital processing of the images and the economic point of view.
At present various image compression algorithms have been developed. A joint effort between the ITU (International Telecommunication Union) and the ISO (International Organisation for Standardization) has resulted in the creation of the compression standard for still images known under the name JPEG (Joint Photographic Expert Group). This algorithm is defined in xe2x80x9cITU-T Recommendation T.81, Digital Compression and Coding of Continuous-tone Still Imagesxe2x80x9d (September 1992) and is fully illustrated in W. B. Pennebaker and J. L. Mitchell, xe2x80x9cJPEG Still Image Compression Standardxe2x80x9d, Van Nostrand Reinhold, New York, N.Y., USA, 1993.
When using the JPEG algorithm the compression ratio, i.e. the number of bits in the un-compressed image divided by the number of bits in the compressed image varies as a function of the complexity of the image. Thus, for example, the compression ratio of an image of a sky with few clouds is twice or three times, even more, the compression ratio of an image of a crowd in a stadium, for a substantially identical quality of restitution.
In many applications it is desirable or necessary for the user and/or the system to be able to control the compression ratio of the acquired images. In an apparatus for recording digital views, such as a photographic apparatus, it is important to be able to foresee the size of the compressed images, in order to keep the allocation of the memory of the apparatus under control.
Controlling the compression ratio is also important in networks which transmit still images or sequences of images. In these networks the time specified for transmitting a compressed image is fixed, or restricted at least, and cannot exceed a certain value, which rules out use of coding schemes which do not have control over the compression ratio.
The present invention seeks to provide an image compression process in which it is possible to choose the compression ratio with excellent precision.
In order to achieve this object, the process according to the invention is characterized in that it comprises the steps of:
compressing a digital image by means of conventional process having at least one parameter allowing the compression ratio to be modified, i.e. the ratio of the size of the un-compressed image to the size of the compressed image,
determining the compression ratio of the said conventional process,
verifying whether the compression ratio lies in a range of tolerance of a value of a specified compression ratio,
modifying said parameter if the compression ratio does not lie in the range of tolerance, and
repeating the compression of the image until the compression ratio lies in the range of tolerance.
According to a preferred embodiment, the conventional compression process is the JPEG process and the parameter which is acted upon is a scale factor serving to modify the values of the normalization matrix used by the algorithm of the JPEG process.
In the process according to the invention an initial scale factor is advantageously defined, the JPEG process is applied a first time using the initial scale factor and said process is applied again with the scale factor being modified if the actual compression ratio does not lie in the range of tolerance of the specified compression ratio.
According to an advantageous implementation of the process, the scale factor is increased when the actual compression ratio is lower than the specified compression ratio and is decreased when the actual compression ratio is greater than the specified compression ratio.
The scale factor is advantageously modified as a function of an at least partially linear model representing the compression ratio as a function of the scale factor.
Preferably the actual compression ratio is determined using said initial scale factor, the curve representing the compression ratio as a function of the scale factor is approximated by a straight line having predetermined slope m0 and passing through a point having the initial scale factor as abscissa and the actual compression ratio obtained by applying the JPEG process with the initial scale factor as ordinate, a scale factor is determined on the basis of the straight line approximation and of the specified compression ratio, the JPEG process is applied again using this new scale factor, it is verified whether the actual compression ratio lies in the range of tolerance of the specified compression ratio, the process is terminated if the actual compression ratio lies within this range, otherwise a new scale factor is determined on the basis of a straight line approximation to the curve of the actual compression ratio as a function of the scale factor.
According to a variant embodiment, the curve representing the actual compression ratio as a function of the scale factor is advantageously approximated by straight line segments having different slopes and forming a continuous curve.